package cn.edu.scau.cmi.luotiansheng.composite.test;

public class Leaf extends Conponent{
	
	
	public Leaf(String name,Conponent parent ) {
	
		this.name=name;
		this.parent=parent;
		if(parent==null) {
			this.deep=0;
		}else {
			this.deep=this.parent.deep+1;
		}
	}
	
	

	public void setDeep(Integer deep) {
		this.deep=deep;
	}
	
	public Integer getDeep() {
		return this.deep;
	}
	
	public void setName(String name) {
		this.name=name;
		
	}
	
	public String getName() {
		return this.name;
	}
	
	public void setParent(Conponent parent) {
		this.parent=parent;
		
	}
	
	public Conponent getParent() {
		return this.parent;
	}

	@Override
	public void show() {
		// TODO Auto-generated method stub
		for(int i=0;i<this.deep;i++) {
			System.out.print("\t");
		}
		System.out.println(this.getParent().name+":    Leaf    "+this.name+" "+this.deep);
	}
	
	
}
